package com.himaci.gtbattle;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.backends.jogl.JoglApplication;
import com.himaci.gtbattle.model.AI;
import com.himaci.gtbattle.model.Player;
import com.himaci.gtbattle.model.Skill;
import com.himaci.gtbattle.model.World;

/**
 * Desktop Launcher using JoglApplication
 *
 * @author XNPSDN
 */
public class Main {

    final static Game GAME_INSTANCE = new GTBattle();
    final static String TITLE = "GT Battle!";
    final static int WIDTH = 480 * 3 / 2;
    final static int HEIGHT = 320 * 3 / 2;
    final static boolean USE_OPENGL2 = false;

    public Main() {
    }

    // Run the application using JoglApplication
    public static void main(String[] args) {
	JoglApplication app;
	app = new JoglApplication(GAME_INSTANCE, TITLE, WIDTH, HEIGHT, USE_OPENGL2);

	System.out.println("JoglApplication started.");
	System.out.println("Project Title : " + TITLE);
	System.out.println("Screen Resolution : " + WIDTH + " x " + HEIGHT + "px");
	System.out.println("Java Memory Heap : " + app.getJavaHeap());
	System.out.println("");

	//test();
    }

    public static void test() {
	System.out.println("start");
	long startTime = System.currentTimeMillis();

	World world = new World(AI.NO_AI, AI.LEVEL_ASIAN);

	world.advance();
	world.updateDead();
	world.advance();
	world.updateDead();
	world.advance();
	world.updateDead();
	world.advance();
	world.updateDead();
	world.advance();
	world.updateDead();
	world.advance();
	world.updateDead();
	world.advance();
	world.updateDead();
	world.advance();
	world.updateDead();

	// manual
	/* world.display();
	 *
	 * System.out.println("inc pow");
	 * world.player2.characters[2].skill(world.player2.characters[0], Skill.INCREASE_POWER_SKILL);
	 * world.updateDead();
	 * world.advance();
	 * world.updateDead();
	 * world.display();
	 *
	 * System.out.println("meteor");
	 * world.player1.characters[1].skill(world.player2.characters[0], Skill.METEOR_SKILL);
	 * world.updateDead();
	 * world.advance();
	 * world.updateDead();
	 * world.display();
	 *
	 * System.out.println("inc pow");
	 * world.player2.characters[2].skill(world.player2.characters[0], Skill.INCREASE_POWER_SKILL);
	 * world.updateDead();
	 * world.advance();
	 * world.updateDead();
	 * world.display();
	 *
	 * System.out.println("inc pow");
	 * world.player1.characters[2].skill(world.player1.characters[0], Skill.INCREASE_POWER_SKILL);
	 * world.updateDead();
	 * world.advance();
	 * world.updateDead();
	 * world.display();
	 *
	 * System.out.println("Payoff 1 = " + AI.getPayoff(world, Player.PLAYER_ONE));
	 * System.out.println("Payoff 2 = " + AI.getPayoff(world, Player.PLAYER_TWO)); */

	// otomatis
	world.display();
	world.player1.ai.generateAction(world);
	world.player2.ai.generateAction(world);

	System.out.println("finish");
	System.out.println("execute time : " + (System.currentTimeMillis() - startTime) + "ms");
    }
}
